package main;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * 
 * Window to Display to user a list of contacts
 * 
 * @author Michael
 */
public class PrintContactsWindow extends JDialog {
    
    private static final String PAGETITLE = "Print";

    private JPanel mainPanel;
    private JScrollPane scrollPane;
    private JTextArea resultTextArea;

    /**
     * Constructor to do syntax to get the list to display
     * 
     * @param contacts
     *            a string that the window will print
     */
    public PrintContactsWindow(String contacts) {
        
        this.setIconImage(Toolkit.getDefaultToolkit().getImage("res/icon.png"));
        
        mainPanel = new JPanel();

        resultTextArea = new JTextArea(contacts);
        resultTextArea.setEditable(false);
        scrollPane = new JScrollPane(resultTextArea);
        scrollPane
                .setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scrollPane.setPreferredSize(new Dimension(250, 250));

        mainPanel.add(scrollPane);
        this.add(mainPanel);
        this.setTitle(Main.TITLE + ": " + PAGETITLE);
        pack();
        setResizable(false);
    }

}
